package com.changgou.task;

import com.changgou.task.config.RabbitMQConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Author LQQ
 * @Date 2020/3/17 14:23
 * @Version 1.0
 */
@Component
public class OrderTask {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    /**
     * 自动收货
     *
     */

    @Scheduled(cron = "0 0 0 * * ?")//每天执行一次
    public void autoTake(){
        System.out.println(new Date());


        rabbitTemplate.convertAndSend("",RabbitMQConfig.ORDER_TACK,"暴富");
    }

}
